
from libs.exception import BaseHTTPException
from flask_babel import gettext as _

class HTTPRobotActivateError(BaseHTTPException):
    error_code = "robot_init_config_error"
    description = "The robot init config error.{message}"
    code = 400
    def __init__(self,message:str|None):
        if message:
            self.description = _("The robot init config error.{message}").format(message=message)
        else:
            self.description = _("The robot init config error.")
        super().__init__(description=self.description)

class HTTPRobotNotReadyActiveError(BaseHTTPException):
    error_code = "robot_not_ready_active_error"
    description = "The robot not ready active error.{message}"
    code = 400
    def __init__(self,):
        self.description = _("The robot not ready active error.")
        super().__init__(description=self.description)

class HTTPRobotConfigError(BaseHTTPException):
    error_code = "robot_config_error"
    description = "The robot reserve config error.{message}"
    code = 400
    def __init__(self,message:str|None=None):
        if message:
            self.description = _("The robot reserve config error.{message}").format(message=message)
        else:
            self.description = _("The robot reserve config error.")
        super().__init__(description=self.description)

class HTTPRobotNotFoundError(BaseHTTPException):
    error_code = "robot_not_found"
    description = "The robot not exist."
    code = 400
    def __init__(self,robot_id: str|None = None):
        if robot_id:
            self.description = _("The robot not exist.{robot_id}").format(robot_id=robot_id)
        else:
            self.description = _("The robot not exist.")
        super().__init__(description=self.description)

class HTTPRobotNotActivatedError(BaseHTTPException):
    error_code = "robot_not_activated"
    description = "The robot not activated."
    code = 400
    def __init__(self):
        self.description = _("The robot not activated.")
        super().__init__(description=self.description)

class HTTPRobotImportError(BaseHTTPException):
    error_code = "robot_import_error"
    description = "Import robots error.{message}"
    code = 400
    def __init__(self,message:str|None=None):
        if message:
            self.description = _("Import robots error.{message}").format(message=message)
        else:
            self.description = _("Import robots error.")
        super().__init__(description=self.description)